package com.wst.system.util;

import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.lang3.StringUtils;

public class JSONUtil {

    public static boolean containsKey(JSONObject jsonObject, String key) {
        if(jsonObject == null) {
            return false;
        }
        if(!jsonObject.containsKey(key)){
            return false;
        }
        if(jsonObject.get(key)==null){
            return false;
        }
        return true;
    }

    public static boolean isNotBlank(JSONObject jsonObject, String key) {
        if(jsonObject == null || !jsonObject.containsKey(key) || jsonObject.get(key)==null) {
            return false;
        }
        return StringUtils.isNotBlank(jsonObject.get(key).toString());
    }
}
